set(TCL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/openocd/tcl)
set(TCL_LITE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/openocd/tcl-lite)

file(COPY ${TCL_DIR}/interface/esp_gpio_jtag.cfg DESTINATION ${TCL_LITE_DIR}/interface)
file(COPY ${TCL_DIR}/interface/esp_gpio_swd.cfg DESTINATION ${TCL_LITE_DIR}/interface)
file(COPY ${TCL_DIR}/target/esp_common.cfg DESTINATION ${TCL_LITE_DIR}/target)
file(COPY ${TCL_DIR}/target/esp32-solo-1.cfg DESTINATION ${TCL_LITE_DIR}/target)
file(COPY ${TCL_DIR}/target/esp32.cfg DESTINATION ${TCL_LITE_DIR}/target)
file(COPY ${TCL_DIR}/target/esp32c2.cfg DESTINATION ${TCL_LITE_DIR}/target)
file(COPY ${TCL_DIR}/target/esp32c3.cfg DESTINATION ${TCL_LITE_DIR}/target)
file(COPY ${TCL_DIR}/target/esp32s2.cfg DESTINATION ${TCL_LITE_DIR}/target)
file(COPY ${TCL_DIR}/target/esp32s3.cfg DESTINATION ${TCL_LITE_DIR}/target)
file(COPY ${TCL_DIR}/target/esp32c6.cfg DESTINATION ${TCL_LITE_DIR}/target)
file(COPY ${TCL_DIR}/target/esp32h2.cfg DESTINATION ${TCL_LITE_DIR}/target)
file(COPY ${TCL_DIR}/target/xtensa-core-esp32.cfg DESTINATION ${TCL_LITE_DIR}/target)
file(COPY ${TCL_DIR}/target/xtensa-core-esp32s2.cfg DESTINATION ${TCL_LITE_DIR}/target)
file(COPY ${TCL_DIR}/target/xtensa-core-esp32s3.cfg DESTINATION ${TCL_LITE_DIR}/target)
file(COPY ${TCL_DIR}/target/stm32f1x.cfg DESTINATION ${TCL_LITE_DIR}/target)
file(COPY ${TCL_DIR}/target/swj-dp.tcl DESTINATION ${TCL_LITE_DIR}/target)
file(COPY ${TCL_DIR}/tools/firmware-recovery.tcl DESTINATION ${TCL_LITE_DIR}/tools)
file(COPY ${TCL_DIR}/tools/memtest.tcl DESTINATION ${TCL_LITE_DIR}/tools)
file(COPY ${TCL_DIR}/bitsbytes.tcl DESTINATION ${TCL_LITE_DIR})
file(COPY ${TCL_DIR}/mem_helper.tcl DESTINATION ${TCL_LITE_DIR})
file(COPY ${TCL_DIR}/memory.tcl DESTINATION ${TCL_LITE_DIR})
file(COPY ${TCL_DIR}/mmr_helpers.tcl DESTINATION ${TCL_LITE_DIR})
message(STATUS "Reduced tcl directory created automatically in ${TCL_LITE_DIR}")
